home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Pier Shareware 1
/
Pier Shareware 1.iso
/
007a
/
courspas.exe
/
CHAP17.EXE
/
POOGRAPH.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-01-11
|
5KB
|
176 lines
unit poograph; {POOGRAPH.PAS}
{------------------------------------------------}
{ Interface }
{------------------------------------------------}
interface
uses
graph, crt; {unité de Turbo Pascal 6 }
type
axe = object
X1, Y1: integer;
procedure init (initX1, initY1: integer);
end;
Point = object (axe)
X2, Y2: integer;
constructor init (initX1, initY1,
initX2, initY2: integer);
procedure afficher; virtual;
procedure effacer; virtual;
procedure tourner;
end;
Trait = object (Point)
procedure afficher; virtual;
procedure effacer; virtual;
end;
Rectangl = object (Point)
procedure afficher; virtual;
procedure effacer; virtual;
end;
Boite = object (Point)
profondeur: word;
position: boolean;
constructor Init (initX1, initY1,
initX2, initY2: integer;
initprofondeur: word;
initposition: boolean);
procedure afficher; virtual;
procedure effacer; virtual;
end;
{------------------------------------------------}
{ Implementation }
{------------------------------------------------}
implementation
{----------------------------------------------------}
{ Méthodes de axe }
{----------------------------------------------------}
procedure axe.init (initX1, initY1: integer);
begin
x1 := initX1;
y1 := initY1;
end;
{----------------------------------------------------}
{ Méthodes de Point }
{----------------------------------------------------}
constructor Point.Init (InitX1, InitY1,
initX2, initY2:integer);
begin;
axe.init (initX1, InitY1);
X2 := initX2;
Y2 := initY2;
end;
procedure Point.afficher;
begin
putpixel (x1, y1, 14);
putpixel (x2, y2, 14);
end;
procedure Point.effacer;
begin
putpixel (x1, y1, getbkcolor);
putpixel (x2, y2, getbkcolor);
end;
procedure Point.tourner;
var
r,i,xa: integer;
X1tmp, Y1tmp, X2tmp, Y2tmp: integer;
begin
xa := 0;
X1tmp := x1;
Y1tmp := y1;
X2tmp := x2;
Y2tmp := y2;
r := getmaxy div 5;
for i := 1 to 630 do
begin;
xa := xa+1;
Y2tmp := Y1tmp-round(r*cos(xa/100));
case xa of
1..157 : X2tmp := X1tmp+xa;
158..314: X2tmp := X1tmp+314-xa;
315..470: X2tmp := X1tmp+314-xa;
471..630: X2tmp := X1tmp-630+xa;
end;
Point.init (X1tmp, Y1tmp, X2tmp, Y2tmp);
afficher;
delay(15);
effacer;
end;
end;
{----------------------------------------------------}
{ Méthodes de Trait }
{----------------------------------------------------}
procedure Trait.afficher;
begin
moveto (x1, y1);
setcolor(14);
lineto (x2, y2);
end;
procedure Trait.effacer;
begin
moveto (x1, y1);
setcolor (getbkcolor);
lineto (x2, y2);
end;
{----------------------------------------------------}
{ Méthodes de Rectangl }
{----------------------------------------------------}
procedure Rectangl.afficher;
begin;
setcolor(14);
rectangle (x1, y1, x2, y2);
end;
procedure Rectangl.effacer;
begin;
setcolor (getbkcolor);
rectangle (x1, y1, x2, y2);
end;
{----------------------------------------------------}
{ Méthodes de Boite }
{----------------------------------------------------}
constructor Boite.Init (initX1, initY1,
initX2, initY2: integer;
initprofondeur: word;
initposition: boolean);
begin
Point.init (initx1, inity1, initx2, inity2);
profondeur := initprofondeur;
position := initposition;
end;
procedure boite.afficher;
begin;
setcolor(14);
bar3d (x1, y1, x2, y2, profondeur, position);
end;
procedure boite.effacer;
begin
setcolor (getbkcolor);
if x2 < 162 then y2 := y2+1;
bar3d (x1, y1, x2, y2, profondeur, position);
end;
{------------------------------------------------}
{ End of Unit }
{------------------------------------------------}
end.